<template>
    <div>
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item>
                    <i class="el-icon-lx-calendar"></i> 表单
                </el-breadcrumb-item>
                <el-breadcrumb-item>基本表单</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="container">
            <div class="form-box">
                <el-form ref="form" :model="form" label-width="80px">
                           <el-form-item label="商品名称">
                        <el-input v-model="form.commodityName"></el-input>
                    </el-form-item>
                      <el-form-item label="商品价格">
                        <el-input v-model="form.commoditySalePrice"></el-input>
                    </el-form-item>
                        <el-form-item label="商品描述">
                        <el-input v-model="form.commodityDetails"></el-input>
                    </el-form-item>
                        <el-form-item label="商品如图片">
                        <el-input v-model="form.commodityImg"></el-input>
                    </el-form-item>
                        <el-form-item label="点赞评论数">
                        <el-input v-model="form.commentCount"></el-input>
                    </el-form-item>
                        <el-form-item label="商品销量">
                        <el-input v-model="form.commoditySaleNum"></el-input>
                    </el-form-item>
                        <el-form-item label="商品游览量">
                        <el-input v-model="form.commodityBorwseNum"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="onSubmit">添加</el-button>
                        <el-button>取消</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </div>
    </div>
</template>

<script>

import axios from 'axios'
export default {
    name: 'baseform',
    data() {
        return {
           
            form: {
                  commodityName:'',
commoditySalePrice:'',
commodityDetails:'',
commodityImg:'',
commentCount:'',
commoditySaleNum:'',
commodityBorwseNum:'',
            }
        };
    },
    methods: {
        onSubmit() {
        axios({
             method:"post",
             url:"https://localhost:44310/app/Gadd",
           
         }).then((res)=>{
             if(res.data.code>0){
                 alert('添加角色成功');
             
                  this.$router.push("/basetable");
             }
             else{
                 alert('添加角色失败');
             }
         })





        }
    }
};
</script>
